package bullets;

import java.awt.Graphics;
import java.awt.image.BufferedImage;

import core.World;

public class BulletBoss extends Bullet{
	/**
	 * 
	 */
	private static final long serialVersionUID = -3187677290536111869L;
	private static BufferedImage image;
	private int speedX;
	private int speedY;
	static {
		image = readImage("src/images/followbullet.png");
	}
	public BulletBoss() {
		super();
	}

	public BulletBoss(int x, int y) {
		super(25, 27, x, y);//宽和高之后再确定，xy初始位置由boss的位置决定
		int num = (int)(Math.random()*10);
		if(num<=4){
			speedX = 3;			
		}else {
			speedX = -3;	
		}
		speedY = 3;
	}
	public void step2(int x,int y) {//大招出现时的移动方式
		if(x<this.x) {
			this.x-=speedX;
		}else {
			this.x+=speedX;
		}
		if(y<this.y) {
			this.y-=speedY;
		}else {
			this.y+=speedY;
		}
	}
	public BufferedImage getImage() {
		if(isLife()) {
			return image;
		}
		return null;
	}

	public void step() {
		if(x<0 || x> World.WORLD_HEIGHT-this.width) {
			speedX*=-1;
		}
		x += speedX;
		y += speedY;
	}	
	@Override
	public void paintImage(Graphics g) {
		g.drawImage(getImage(), x, y,null);			
	}
	
}
